﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="managePatient.aspx.cs" Inherits="WebRole1.managePatient" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <table>
    <tr>
    <td>
    <strong>Current Patient<br />
        </strong>
    </td>
    <td>
        <asp:GridView ID="GridView2" runat="server" AllowSorting="True" 
            AutoGenerateColumns="False" DataKeyNames="uid" 
            DataSourceID="SqlDataSource3">
            <Columns>
                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
                <asp:BoundField DataField="uid" HeaderText="uid" InsertVisible="False" 
                    ReadOnly="True" SortExpression="uid" />
                <asp:BoundField DataField="LastName" HeaderText="LastName" 
                    SortExpression="LastName" />
                <asp:BoundField DataField="FirstName" HeaderText="FirstName" 
                    SortExpression="FirstName" />
                <asp:BoundField DataField="contactNum" HeaderText="contactNum" 
                    SortExpression="contactNum" />
                <asp:BoundField DataField="Address1" HeaderText="Address1" 
                    SortExpression="Address1" />
                <asp:BoundField DataField="Address2" HeaderText="Address2" 
                    SortExpression="Address2" />
                <asp:BoundField DataField="Postcode" HeaderText="Postcode" 
                    SortExpression="Postcode" />
                <asp:BoundField DataField="doctor" HeaderText="doctor" 
                    SortExpression="doctor" />
                <asp:BoundField DataField="e_name" HeaderText="e_name" 
                    SortExpression="e_name" />
                <asp:BoundField DataField="e_relationship" HeaderText="e_relationship" 
                    SortExpression="e_relationship" />
                <asp:BoundField DataField="e_contactNum" HeaderText="e_contactNum" 
                    SortExpression="e_contactNum" />
                <asp:BoundField DataField="dateOfBirth" HeaderText="dateOfBirth" 
                    SortExpression="dateOfBirth" />
                <asp:BoundField DataField="email" HeaderText="email" SortExpression="email" />
                <asp:BoundField DataField="gender" HeaderText="gender" 
                    SortExpression="gender" />
                <asp:BoundField DataField="contactNumHome" HeaderText="contactNumHome" 
                    SortExpression="contactNumHome" />
                <asp:BoundField DataField="title" HeaderText="title" SortExpression="title" />
                <asp:BoundField DataField="contactNumWork" HeaderText="contactNumWork" 
                    SortExpression="contactNumWork" />
                <asp:BoundField DataField="country" HeaderText="country" 
                    SortExpression="country" />
            </Columns>
        </asp:GridView>
        <br />
        <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
            ConnectionString="<%$ ConnectionStrings:dbConnection %>" 
            DeleteCommand="DELETE FROM [patient] WHERE [uid] = @uid" 
            InsertCommand="INSERT INTO [patient] ([LastName], [FirstName], [Age], [contactNum], [Address1], [Address2], [Postcode], [doctor], [e_name], [e_relationship], [e_contactNum], [dateOfBirth], [email], [gender], [contactNumHome], [title], [identifier], [contactNumWork], [country]) VALUES (@LastName, @FirstName, @Age, @contactNum, @Address1, @Address2, @Postcode, @doctor, @e_name, @e_relationship, @e_contactNum, @dateOfBirth, @email, @gender, @contactNumHome, @title, @identifier, @contactNumWork, @country)" 
            SelectCommand="SELECT * FROM [patient]" 
            
            UpdateCommand="UPDATE [patient] SET [LastName] = @LastName, [FirstName] = @FirstName, [Age] = @Age, [contactNum] = @contactNum, [Address1] = @Address1, [Address2] = @Address2, [Postcode] = @Postcode, [doctor] = @doctor, [e_name] = @e_name, [e_relationship] = @e_relationship, [e_contactNum] = @e_contactNum, [dateOfBirth] = @dateOfBirth, [email] = @email, [gender] = @gender, [contactNumHome] = @contactNumHome, [title] = @title, [identifier] = @identifier, [contactNumWork] = @contactNumWork, [country] = @country WHERE [uid] = @uid" 
            oninserted="SqlDataSource3_Inserted">
            <DeleteParameters>
                <asp:Parameter Name="uid" Type="Decimal" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="LastName" Type="String" />
                <asp:Parameter Name="FirstName" Type="String" />
                <asp:Parameter Name="Age" Type="Decimal" />
                <asp:Parameter Name="contactNum" Type="String" />
                <asp:Parameter Name="Address1" Type="String" />
                <asp:Parameter Name="Address2" Type="String" />
                <asp:Parameter Name="Postcode" Type="String" />
                <asp:Parameter Name="doctor" Type="String" />
                <asp:Parameter Name="e_name" Type="String" />
                <asp:Parameter Name="e_relationship" Type="String" />
                <asp:Parameter Name="e_contactNum" Type="String" />
                <asp:Parameter Name="dateOfBirth" Type="DateTime" />
                <asp:Parameter Name="email" Type="String" />
                <asp:Parameter Name="gender" Type="String" />
                <asp:Parameter Name="contactNumHome" Type="String" />
                <asp:Parameter Name="title" Type="String" />
                <asp:Parameter Name="identifier" Type="String" />
                <asp:Parameter Name="contactNumWork" Type="String" />
                <asp:Parameter Name="country" Type="String" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="LastName" Type="String" />
                <asp:Parameter Name="FirstName" Type="String" />
                <asp:Parameter Name="Age" Type="Decimal" />
                <asp:Parameter Name="contactNum" Type="String" />
                <asp:Parameter Name="Address1" Type="String" />
                <asp:Parameter Name="Address2" Type="String" />
                <asp:Parameter Name="Postcode" Type="String" />
                <asp:Parameter Name="doctor" Type="String" />
                <asp:Parameter Name="e_name" Type="String" />
                <asp:Parameter Name="e_relationship" Type="String" />
                <asp:Parameter Name="e_contactNum" Type="String" />
                <asp:Parameter Name="dateOfBirth" Type="DateTime" />
                <asp:Parameter Name="email" Type="String" />
                <asp:Parameter Name="gender" Type="String" />
                <asp:Parameter Name="contactNumHome" Type="String" />
                <asp:Parameter Name="title" Type="String" />
                <asp:Parameter Name="identifier" Type="String" />
                <asp:Parameter Name="contactNumWork" Type="String" />
                <asp:Parameter Name="country" Type="String" />
                <asp:Parameter Name="uid" Type="Decimal" />
            </UpdateParameters>
        </asp:SqlDataSource>
    </td>
    </tr>
    <tr>
    <td>
        &nbsp;</td>
    <td>
        &nbsp;</td>
    </tr>
     <tr>
    <td colspan="2">
    <strong>Create new patient</strong></td>
    </tr>
     <tr>
    <td>
    Step 1: Enter Patient Details</td>
    <td>
    <asp:FormView ID="FormView1" runat="server" DataKeyNames="uid" 
        DataSourceID="SqlDataSource3" DefaultMode="Insert">
        <EditItemTemplate>
            uid:
            <asp:Label ID="uidLabel1" runat="server" Text='<%# Eval("uid") %>' />
            <br />
            LastName:
            <asp:TextBox ID="LastNameTextBox" runat="server" 
                Text='<%# Bind("LastName") %>' />
            <br />
            FirstName:
            <asp:TextBox ID="FirstNameTextBox" runat="server" 
                Text='<%# Bind("FirstName") %>' />
            <br />
            Age:
            <asp:TextBox ID="AgeTextBox" runat="server" Text='<%# Bind("Age") %>' />
            <br />
            contactNum:
            <asp:TextBox ID="contactNumTextBox" runat="server" 
                Text='<%# Bind("contactNum") %>' />
            <br />
            Address1:
            <asp:TextBox ID="Address1TextBox" runat="server" 
                Text='<%# Bind("Address1") %>' />
            <br />
            Address2:
            <asp:TextBox ID="Address2TextBox" runat="server" 
                Text='<%# Bind("Address2") %>' />
            <br />
            Postcode:
            <asp:TextBox ID="PostcodeTextBox" runat="server" 
                Text='<%# Bind("Postcode") %>' />
            <br />
            doctor:
            <asp:TextBox ID="doctorTextBox" runat="server" Text='<%# Bind("doctor") %>' />
            <br />
            e_name:
            <asp:TextBox ID="e_nameTextBox" runat="server" Text='<%# Bind("e_name") %>' />
            <br />
            e_relationship:
            <asp:TextBox ID="e_relationshipTextBox" runat="server" 
                Text='<%# Bind("e_relationship") %>' />
            <br />
            e_contactNum:
            <asp:TextBox ID="e_contactNumTextBox" runat="server" 
                Text='<%# Bind("e_contactNum") %>' />
            <br />
            dateOfBirth:
            <asp:TextBox ID="dateOfBirthTextBox" runat="server" 
                Text='<%# Bind("dateOfBirth") %>' />
            <br />
            email:
            <asp:TextBox ID="emailTextBox" runat="server" Text='<%# Bind("email") %>' />
            <br />
            gender:
            <asp:TextBox ID="genderTextBox" runat="server" Text='<%# Bind("gender") %>' />
            <br />
            contactNumHome:
            <asp:TextBox ID="contactNumHomeTextBox" runat="server" 
                Text='<%# Bind("contactNumHome") %>' />
            <br />
            title:
            <asp:TextBox ID="titleTextBox" runat="server" Text='<%# Bind("title") %>' />
            <br />
            identifier:
            <asp:TextBox ID="identifierTextBox" runat="server" 
                Text='<%# Bind("identifier") %>' />
            <br />
            contactNumWork:
            <asp:TextBox ID="contactNumWorkTextBox" runat="server" 
                Text='<%# Bind("contactNumWork") %>' />
            <br />
            country:
            <asp:TextBox ID="countryTextBox" runat="server" Text='<%# Bind("country") %>' />
            <br />
            <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" 
                CommandName="Update" Text="Update" />
            &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" 
                CausesValidation="False" CommandName="Cancel" Text="Cancel" />
        </EditItemTemplate>
        <InsertItemTemplate>
            LastName:
            <asp:TextBox ID="LastNameTextBox" runat="server" 
                Text='<%# Bind("LastName") %>' />
            <br />
            FirstName:
            <asp:TextBox ID="FirstNameTextBox" runat="server" 
                Text='<%# Bind("FirstName") %>' />
            <br />
            Age:
            <asp:TextBox ID="AgeTextBox" runat="server" Text='<%# Bind("Age") %>' />
            <br />
            contactNum:
            <asp:TextBox ID="contactNumTextBox" runat="server" 
                Text='<%# Bind("contactNum") %>' />
            <br />
            Address1:
            <asp:TextBox ID="Address1TextBox" runat="server" 
                Text='<%# Bind("Address1") %>' />
            <br />
            Address2:
            <asp:TextBox ID="Address2TextBox" runat="server" 
                Text='<%# Bind("Address2") %>' />
            <br />
            Postcode:
            <asp:TextBox ID="PostcodeTextBox" runat="server" 
                Text='<%# Bind("Postcode") %>' />
            <br />
            doctor:
            <asp:TextBox ID="doctorTextBox" runat="server" Text='<%# Bind("doctor") %>' />
            <br />
            e_name:
            <asp:TextBox ID="e_nameTextBox" runat="server" Text='<%# Bind("e_name") %>' />
            <br />
            e_relationship:
            <asp:TextBox ID="e_relationshipTextBox" runat="server" 
                Text='<%# Bind("e_relationship") %>' />
            <br />
            e_contactNum:
            <asp:TextBox ID="e_contactNumTextBox" runat="server" 
                Text='<%# Bind("e_contactNum") %>' />
            <br />
            dateOfBirth:
            <asp:TextBox ID="dateOfBirthTextBox" runat="server" 
                Text='<%# Bind("dateOfBirth") %>' />
            <br />
            email:
            <asp:TextBox ID="emailTextBox" runat="server" Text='<%# Bind("email") %>' />
            <br />
            gender:
            <asp:TextBox ID="genderTextBox" runat="server" Text='<%# Bind("gender") %>' />
            <br />
            contactNumHome:
            <asp:TextBox ID="contactNumHomeTextBox" runat="server" 
                Text='<%# Bind("contactNumHome") %>' />
            <br />
            title:
            <asp:TextBox ID="titleTextBox" runat="server" Text='<%# Bind("title") %>' />
            <br />
            identifier:
            <asp:TextBox ID="identifierTextBox" runat="server" 
                Text='<%# Bind("identifier") %>' />
            <br />
            contactNumWork:
            <asp:TextBox ID="contactNumWorkTextBox" runat="server" 
                Text='<%# Bind("contactNumWork") %>' />
            <br />
            country:
            <asp:TextBox ID="countryTextBox" runat="server" Text='<%# Bind("country") %>' />
            <br />
            <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" 
                CommandName="Insert" Text="Insert" />
            &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" 
                CausesValidation="False" CommandName="Cancel" Text="Cancel" />
        </InsertItemTemplate>
        <ItemTemplate>
            uid:
            <asp:Label ID="uidLabel" runat="server" Text='<%# Eval("uid") %>' />
            <br />
            LastName:
            <asp:Label ID="LastNameLabel" runat="server" Text='<%# Bind("LastName") %>' />
            <br />
            FirstName:
            <asp:Label ID="FirstNameLabel" runat="server" Text='<%# Bind("FirstName") %>' />
            <br />
            Age:
            <asp:Label ID="AgeLabel" runat="server" Text='<%# Bind("Age") %>' />
            <br />
            contactNum:
            <asp:Label ID="contactNumLabel" runat="server" 
                Text='<%# Bind("contactNum") %>' />
            <br />
            Address1:
            <asp:Label ID="Address1Label" runat="server" Text='<%# Bind("Address1") %>' />
            <br />
            Address2:
            <asp:Label ID="Address2Label" runat="server" Text='<%# Bind("Address2") %>' />
            <br />
            Postcode:
            <asp:Label ID="PostcodeLabel" runat="server" Text='<%# Bind("Postcode") %>' />
            <br />
            doctor:
            <asp:Label ID="doctorLabel" runat="server" Text='<%# Bind("doctor") %>' />
            <br />
            e_name:
            <asp:Label ID="e_nameLabel" runat="server" Text='<%# Bind("e_name") %>' />
            <br />
            e_relationship:
            <asp:Label ID="e_relationshipLabel" runat="server" 
                Text='<%# Bind("e_relationship") %>' />
            <br />
            e_contactNum:
            <asp:Label ID="e_contactNumLabel" runat="server" 
                Text='<%# Bind("e_contactNum") %>' />
            <br />
            dateOfBirth:
            <asp:Label ID="dateOfBirthLabel" runat="server" 
                Text='<%# Bind("dateOfBirth") %>' />
            <br />
            email:
            <asp:Label ID="emailLabel" runat="server" Text='<%# Bind("email") %>' />
            <br />
            gender:
            <asp:Label ID="genderLabel" runat="server" Text='<%# Bind("gender") %>' />
            <br />
            contactNumHome:
            <asp:Label ID="contactNumHomeLabel" runat="server" 
                Text='<%# Bind("contactNumHome") %>' />
            <br />
            title:
            <asp:Label ID="titleLabel" runat="server" Text='<%# Bind("title") %>' />
            <br />
            identifier:
            <asp:Label ID="identifierLabel" runat="server" 
                Text='<%# Bind("identifier") %>' />
            <br />
            contactNumWork:
            <asp:Label ID="contactNumWorkLabel" runat="server" 
                Text='<%# Bind("contactNumWork") %>' />
            <br />
            country:
            <asp:Label ID="countryLabel" runat="server" Text='<%# Bind("country") %>' />
            <br />
            <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" 
                CommandName="Edit" Text="Edit" />
            &nbsp;<asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False" 
                CommandName="Delete" Text="Delete" />
            &nbsp;<asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" 
                CommandName="New" Text="New" />
        </ItemTemplate>
    </asp:FormView>
        <br />
        <asp:Label ID="lblMessage" runat="server" Text="Label"></asp:Label>
    </td>
    </tr>
     <tr>
    <td>
        <strong>Assign photo to patient</strong></td>
    <td>
        &nbsp;</td>
    </tr>
     <tr>
    <td>
    &nbsp;Step 2: Enter Patient UID</td>
    <td>
    <asp:TextBox ID="tbx_patientUID" runat="server" Width="159px"></asp:TextBox>
    </td>
    </tr>
     <tr>
    <td>
    Step 3:Upload a patient photo:</td>
    <td>
    <asp:FileUpload ID="FileUpload1" runat="server" />
    </td>
    </tr>
     <tr>
    <td>
        Step 4: Enter<br />
    </td>
    <td>
    <asp:Button ID="Button1" runat="server" onclick="Button1_Click" Text="Upload" 
            Height="26px" UseSubmitBehavior="False" />
        <br />
    Image Link:
    <asp:Label ID="lbl_path" runat="server" Text="Label"></asp:Label>
    </td>
    </tr>
     <tr>
    <td>
        &nbsp;</td>
    <td>
        &nbsp;</td>
    </tr>
     <tr>
    <td>
        Current Patient_Photo</td>
    <td>
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" 
            DataKeyNames="patient,faceImgPath" DataSourceID="SqlDataSource2" 
            AllowSorting="True">
            <Columns>
                <asp:CommandField ShowDeleteButton="True" />
                <asp:BoundField DataField="patient" HeaderText="patient" ReadOnly="True" 
                    SortExpression="patient" />
                <asp:BoundField DataField="faceImgPath" HeaderText="faceImgPath" 
                    ReadOnly="True" SortExpression="faceImgPath" />
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
            ConnectionString="<%$ ConnectionStrings:dbConnection %>" 
            DeleteCommand="DELETE FROM [patient_faceImg] WHERE [patient] = @original_patient AND [faceImgPath] = @original_faceImgPath" 
            InsertCommand="INSERT INTO [patient_faceImg] ([patient], [faceImgPath]) VALUES (@patient, @faceImgPath)" 
            OldValuesParameterFormatString="original_{0}" 
            SelectCommand="SELECT * FROM [patient_faceImg]">
            <DeleteParameters>
                <asp:Parameter Name="original_patient" Type="Decimal" />
                <asp:Parameter Name="original_faceImgPath" Type="String" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="patient" Type="Decimal" />
                <asp:Parameter Name="faceImgPath" Type="String" />
            </InsertParameters>
        </asp:SqlDataSource>
    </td>
    </tr>
     <tr>
    <td>
        &nbsp;</td>
    <td>
        &nbsp;</td>
    </tr>
     <tr>
    <td>
        Enter URL to view Image:</td>
    <td>
        <asp:TextBox ID="tbx_imageURL" runat="server" Width="181px"></asp:TextBox>
        <asp:Button ID="btn_view" runat="server" onclick="btn_view_Click" Text="View" 
            UseSubmitBehavior="False" />
    </td>
    </tr>
     <tr>
    <td>
        &nbsp;</td>
    <td>
        &nbsp;</td>
    </tr>
     <tr>
    <td>
        Current Problem</td>
    <td>
        <asp:GridView ID="GridView3" runat="server" AllowSorting="True" 
            AutoGenerateColumns="False" DataKeyNames="uid" DataSourceID="SqlDataSource1">
            <Columns>
                <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
                <asp:BoundField DataField="uid" HeaderText="uid" InsertVisible="False" 
                    ReadOnly="True" SortExpression="uid" />
                <asp:BoundField DataField="patientID" HeaderText="patientID" 
                    SortExpression="patientID" />
                <asp:BoundField DataField="joint" HeaderText="joint" SortExpression="joint" />
                <asp:BoundField DataField="problems" HeaderText="problems" 
                    SortExpression="problems" />
                <asp:BoundField DataField="description" HeaderText="description" 
                    SortExpression="description" />
                <asp:BoundField DataField="severity" HeaderText="severity" 
                    SortExpression="severity" />
                <asp:BoundField DataField="notes" HeaderText="notes" SortExpression="notes" />
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:dbConnection %>" 
            DeleteCommand="DELETE FROM [problem] WHERE [uid] = @uid" 
            InsertCommand="INSERT INTO [problem] ([patientID], [joint], [problems], [description], [severity], [notes]) VALUES (@patientID, @joint, @problems, @description, @severity, @notes)" 
            SelectCommand="SELECT * FROM [problem]" 
            UpdateCommand="UPDATE [problem] SET [patientID] = @patientID, [joint] = @joint, [problems] = @problems, [description] = @description, [severity] = @severity, [notes] = @notes WHERE [uid] = @uid">
            <DeleteParameters>
                <asp:Parameter Name="uid" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="patientID" Type="Decimal" />
                <asp:Parameter Name="joint" Type="String" />
                <asp:Parameter Name="problems" Type="String" />
                <asp:Parameter Name="description" Type="String" />
                <asp:Parameter Name="severity" Type="Int32" />
                <asp:Parameter Name="notes" Type="String" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="patientID" Type="Decimal" />
                <asp:Parameter Name="joint" Type="String" />
                <asp:Parameter Name="problems" Type="String" />
                <asp:Parameter Name="description" Type="String" />
                <asp:Parameter Name="severity" Type="Int32" />
                <asp:Parameter Name="notes" Type="String" />
                <asp:Parameter Name="uid" Type="Int32" />
            </UpdateParameters>
        </asp:SqlDataSource>
    </td>
    </tr>
     <tr>
    <td>
        &nbsp;</td>
    <td>
        &nbsp;</td>
    </tr>
     <tr>
    <td>
        Create Problem</td>
    <td>
        <asp:FormView ID="FormView2" runat="server" DataKeyNames="uid" 
            DataSourceID="SqlDataSource1" DefaultMode="Insert">
            <EditItemTemplate>
                uid:
                <asp:Label ID="uidLabel1" runat="server" Text='<%# Eval("uid") %>' />
                <br />
                patientID:
                <asp:TextBox ID="patientIDTextBox" runat="server" 
                    Text='<%# Bind("patientID") %>' />
                <br />
                joint:
                <asp:TextBox ID="jointTextBox" runat="server" Text='<%# Bind("joint") %>' />
                <br />
                problems:
                <asp:TextBox ID="problemsTextBox" runat="server" 
                    Text='<%# Bind("problems") %>' />
                <br />
                description:
                <asp:TextBox ID="descriptionTextBox" runat="server" 
                    Text='<%# Bind("description") %>' />
                <br />
                severity:
                <asp:TextBox ID="severityTextBox" runat="server" 
                    Text='<%# Bind("severity") %>' />
                <br />
                notes:
                <asp:TextBox ID="notesTextBox" runat="server" Text='<%# Bind("notes") %>' />
                <br />
                <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" 
                    CommandName="Update" Text="Update" />
                &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" 
                    CausesValidation="False" CommandName="Cancel" Text="Cancel" />
            </EditItemTemplate>
            <InsertItemTemplate>
                patientID:
                <asp:TextBox ID="patientIDTextBox" runat="server" 
                    Text='<%# Bind("patientID") %>' />
                <br />
                joint:
                <asp:TextBox ID="jointTextBox" runat="server" Text='<%# Bind("joint") %>' />
                <br />
                problems:
                <asp:TextBox ID="problemsTextBox" runat="server" 
                    Text='<%# Bind("problems") %>' />
                <br />
                description:
                <asp:TextBox ID="descriptionTextBox" runat="server" 
                    Text='<%# Bind("description") %>' />
                <br />
                severity:
                <asp:TextBox ID="severityTextBox" runat="server" 
                    Text='<%# Bind("severity") %>' />
                <br />
                notes:
                <asp:TextBox ID="notesTextBox" runat="server" Text='<%# Bind("notes") %>' />
                <br />
                <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" 
                    CommandName="Insert" Text="Insert" />
                &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" 
                    CausesValidation="False" CommandName="Cancel" Text="Cancel" />
            </InsertItemTemplate>
            <ItemTemplate>
                uid:
                <asp:Label ID="uidLabel" runat="server" Text='<%# Eval("uid") %>' />
                <br />
                patientID:
                <asp:Label ID="patientIDLabel" runat="server" Text='<%# Bind("patientID") %>' />
                <br />
                joint:
                <asp:Label ID="jointLabel" runat="server" Text='<%# Bind("joint") %>' />
                <br />
                problems:
                <asp:Label ID="problemsLabel" runat="server" Text='<%# Bind("problems") %>' />
                <br />
                description:
                <asp:Label ID="descriptionLabel" runat="server" 
                    Text='<%# Bind("description") %>' />
                <br />
                severity:
                <asp:Label ID="severityLabel" runat="server" Text='<%# Bind("severity") %>' />
                <br />
                notes:
                <asp:Label ID="notesLabel" runat="server" Text='<%# Bind("notes") %>' />
                <br />
                <asp:LinkButton ID="EditButton" runat="server" CausesValidation="False" 
                    CommandName="Edit" Text="Edit" />
                &nbsp;<asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False" 
                    CommandName="Delete" Text="Delete" />
                &nbsp;<asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" 
                    CommandName="New" Text="New" />
            </ItemTemplate>
        </asp:FormView>
    </td>
    </tr>
     <tr>
    <td>
        &nbsp;</td>
    <td>
        &nbsp;</td>
    </tr>
     <tr>
    <td>
        Assign EXE to patient</td>
    <td>
        <asp:GridView ID="GridView4" runat="server" AllowSorting="True" 
            AutoGenerateColumns="False" DataKeyNames="exe,patient" 
            DataSourceID="SqlDataSource4">
            <Columns>
                <asp:CommandField ShowDeleteButton="True" />
                <asp:BoundField DataField="exe" HeaderText="exe" ReadOnly="True" 
                    SortExpression="exe" />
                <asp:BoundField DataField="patient" HeaderText="patient" ReadOnly="True" 
                    SortExpression="patient" />
            </Columns>
        </asp:GridView>
        <asp:SqlDataSource ID="SqlDataSource4" runat="server" 
            ConflictDetection="CompareAllValues" 
            ConnectionString="<%$ ConnectionStrings:dbConnection %>" 
            DeleteCommand="DELETE FROM [patient_exe] WHERE [exe] = @original_exe AND [patient] = @original_patient" 
            InsertCommand="INSERT INTO [patient_exe] ([exe], [patient]) VALUES (@exe, @patient)" 
            OldValuesParameterFormatString="original_{0}" 
            SelectCommand="SELECT * FROM [patient_exe]">
            <DeleteParameters>
                <asp:Parameter Name="original_exe" Type="Int32" />
                <asp:Parameter Name="original_patient" Type="Decimal" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="exe" Type="Int32" />
                <asp:Parameter Name="patient" Type="Decimal" />
            </InsertParameters>
        </asp:SqlDataSource>
    </td>
    </tr>
     <tr>
    <td>
        &nbsp;</td>
    <td>
        <asp:FormView ID="FormView3" runat="server" DataKeyNames="exe,patient" 
            DataSourceID="SqlDataSource4" DefaultMode="Insert">
            <EditItemTemplate>
                exe:
                <asp:Label ID="exeLabel1" runat="server" Text='<%# Eval("exe") %>' />
                <br />
                patient:
                <asp:Label ID="patientLabel1" runat="server" Text='<%# Eval("patient") %>' />
                <br />
                <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" 
                    CommandName="Update" Text="Update" />
                &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" 
                    CausesValidation="False" CommandName="Cancel" Text="Cancel" />
            </EditItemTemplate>
            <InsertItemTemplate>
                exe:
                <asp:TextBox ID="exeTextBox" runat="server" Text='<%# Bind("exe") %>' />
                <br />
                patient:
                <asp:TextBox ID="patientTextBox" runat="server" Text='<%# Bind("patient") %>' />
                <br />
                <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" 
                    CommandName="Insert" Text="Insert" />
                &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" 
                    CausesValidation="False" CommandName="Cancel" Text="Cancel" />
            </InsertItemTemplate>
            <ItemTemplate>
                exe:
                <asp:Label ID="exeLabel" runat="server" Text='<%# Eval("exe") %>' />
                <br />
                patient:
                <asp:Label ID="patientLabel" runat="server" Text='<%# Eval("patient") %>' />
                <br />
                <asp:LinkButton ID="DeleteButton" runat="server" CausesValidation="False" 
                    CommandName="Delete" Text="Delete" />
                &nbsp;<asp:LinkButton ID="NewButton" runat="server" CausesValidation="False" 
                    CommandName="New" Text="New" />
            </ItemTemplate>
        </asp:FormView>
    </td>
    </tr>
    </table>
    
    <p>
        <br />
</p>
</asp:Content>
